function powersAB=computeABPowers(Hp, oA, powersA, B)
cB = size(B, 2);
sum = B;
powersAB = zeros(Hp * oA, cB);

powersAB(1:oA, 1:end) = sum;

for i=2:Hp
    [startPointer endPointer] = getPointers(i, oA);
    [sumStartPointer sumEndPointer] = getPointers(i - 1, oA);

    sum = sum + (powersA(sumStartPointer:sumEndPointer, 1:end) * B);
    
    powersAB(startPointer:endPointer, 1:end) = sum; 
end
end